package com.nononsenseapps.feeder.glide;

import android.content.Context;

import androidx.annotation.NonNull;

import com.bumptech.glide.GlideBuilder;
import com.bumptech.glide.annotation.GlideModule;
import com.bumptech.glide.load.engine.cache.DiskCache;
import com.bumptech.glide.load.engine.cache.DiskLruPartitionCacheFactory;
import com.bumptech.glide.module.AppGlideModule;

@GlideModule
public class FeedinGlideModule extends AppGlideModule {
    @Override
    public void applyOptions(@NonNull Context context, GlideBuilder builder) {
        //builder.setMemoryCache(new LruResourceCache(10 * 1024 * 1024));
        DiskLruPartitionCacheFactory.Companion.addFactory(DiskLruPartitionCacheFactory.DISK_LRU_PARTITION_DOWNLOAD_PICTURE,context,DiskLruPartitionCacheFactory.DISK_LRU_PARTITION_DOWNLOAD_PICTURE, DiskCache.Factory.DEFAULT_DISK_CACHE_SIZE);
        builder.setDiskCache(DiskLruPartitionCacheFactory.Companion.getInstance(context));
    }

    @Override
    public boolean isManifestParsingEnabled() {
        return false;
    }
}